package leetcode_201_300;

import com.sun.org.apache.bcel.internal.generic.NEW;
import node.ListNode;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class LeeCode_206 {
    public static void main(String[] args) {

    }

    private static ListNode reverseList(ListNode head) {
        if (head == null)
            return null;
        ListNode cur = head;
        List<ListNode> list = new ArrayList<>();
        while (cur != null) {
            list.add(cur);
            cur = cur.next;
        }
        for (int i = list.size() - 1; i > 0; --i) {
            list.get(i).next = list.get(i - 1);
        }
        list.get(0).next = null;
        return list.get(list.size() - 1);
    }
}
